#ifndef STOCKINDAO_H
#define STOCKINDAO_H

#include "database.h"
#include <QString>

class StockInDAO
{
public:
    explicit StockInDAO(Database *db);

    // 添加入库记录
    bool addStockInRecord(int productId, int quantity, double price,
                         const QString &supplier, int operatorId, const QString &note = "");

    // 获取所有入库记录（用于统计页面）
    QVector<QMap<QString, QVariant>> getAllStockInRecords();
    
    // 根据条件查询入库记录
    QVector<QMap<QString, QVariant>> getStockInRecordsByCondition(
        const QString &startDate = "", const QString &endDate = "",
        int productId = -1, const QString &supplier = "");

    // 事务处理
    bool beginTransaction();
    bool commitTransaction();
    bool rollbackTransaction();

private:
    Database *m_db;
};

#endif // STOCKINDAO_H
